<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/8 0008
 * Time: 上午 9:22
 */
require APPPATH."/controllers/Common.php";

class Register extends Common
{
    function index(){

    }

    function api(){
        $param=[];
        #############
        if($this->req("name")){
            $param['name'] = $this->req("name");
        }else{
            return $this->resp_api([],1005,'缺少必须参数  name');
        }
        #############
        if($this->req("mobile") ){
            $param['mobile'] = $this->req("mobile");
        }else{
            return $this->resp_api([],1005,'缺少必须参数  mobile');exit();
        }
        #############
        if($this->req("password")){
            $param['password'] = $this->pwd(
                $this->req("password")
            );
        }else{
            return $this->resp_api([],1005,'缺少必须参数  password');exit();
        }
        $this->load->model('user');
        $res = User::save($param);
        $code = $res?1000:1010;
        return $this->resp_api([],$code,'');
    }
}